package com.example.dao;

import com.example.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: huang
 * @Date: 2021/10/30 17:18
 * @Description:
 */
@Repository
public class JdbcDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;


    public List<User> findAll() {
        return jdbcTemplate.query("select * from tb_user",
                new BeanPropertyRowMapper<>(User.class));
    }


}
